home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BMUG PD-ROM 1996 Fall
/
BMUG Fall'96 PD-ROM.iso
/
Education
/
Math
/
MathPad 2.4
/
Examples
/
solve
< prev
next >
Wrap
Text File
|
1995-04-29
|
397b
|
24 lines
-- Solution of a system of equations by Cramers rule.
include ":incl:solver"
-- example system of equations
-- 2x + y + z = 2
-- x - y + 5z = 4
-- y - z = 8
A={{ 2, 1, 1}, -- coefficients
{ 1,-1, 5},
{ 0, 1,-1}}
C= { 2, 4, 8} -- constants
solve(A,C):{-8.0,13.0,5.0}
x=solve(A,C)[1]
y=solve(A,C)[2]
z=solve(A,C)[3]
2*x + y + z:2.0
x - y + 5*z:4.0
y - z:8.0